using System.ComponentModel;
using System.Globalization;
using System.Threading;

namespace ResourceExtension.Implementation
{
    public class CultureResourceOptions : IResourceOptions
    {
        private CultureInfo cultureInfo;
        public CultureInfo CultureInfo
        {
            get { return cultureInfo; }
            set
            {
                if (cultureInfo == value)
                    return;

                cultureInfo = value;
                if (PropertyChanged!=null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("CultureInfo"));
                }
            }
        }

        #region Implementation of INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;
        public string ToQuery()
        {
            string cultureName = CultureInfo.Name;
           /* if (cultureName.Contains("-"))
            {
                return cultureName.Substring(0, cultureName.Length - 1) +
                       cultureName.Substring(cultureName.Length - 1).ToLower();
            }*/
            return cultureName;
        }

        #endregion
    }
}